<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


<script>

    var mult = (function(){
        var cache = {};
        return function(){
            console.log(cache)
            var args = Array.prototype.join.call( arguments, ',' );
            if ( cache[ args ] ){
                console.log(1)
                return cache[ args ];
            }
            var a = 1;
            for ( var i = 0, l = arguments.length; i < l; i++ ){
                a = a * arguments[i];
            }
            return cache[ args ] = a;
        }
    })();
    mult( 1, 2, 3 );
    mult( 1, 2, 3 );
    mult( 1, 2, 3 ,4);
    mult( 1, 2, 3 ,4);
</script>

</body>
</html>